import QuickTool from '@/utils/Engineering/QuickTool';
import { maintableOperateExpandList } from '../main.data';

const apiPath = {
  submitDataBaseURL: '/api/common/sys_table_set',
  getDatasourceURL: `/api/common/sys_table_set/page`,
  basis: 'id',
};
const extraData = {
  __sent_data_diff_cover_field: 'code',
};

const pagination = { pageSize: 10, current: 1 };

const tableOperateExpandList = [maintableOperateExpandList.TableFieldSettting];

const popupForm = {
  open_type: 'Drawer',
  width: '65%',
};

const fieldList = [
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '标题', help: '标题', required: true }),
    dataIndex_or_field: 'title',
    key: 'title',
    placeholder: '',
    fixed: 'left',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: 'UUID码', help: 'UUID码', required: true }),
    dataIndex_or_field: 'code',
    key: 'code',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '数据源API', help: '数据源API', required: true }),
    dataIndex_or_field: 'data_url',
    key: 'data_url',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Select',
    title_or_label: QuickTool.tooltip({ title: '尺寸', help: '尺寸', required: true }),
    dataIndex_or_field: 'size',
    key: 'size',
    placeholder: '',
    width: 160,
    col: 12,
    initialValue: '',
    list: [
      { value: 'default', name: 'default' },
      { value: 'middle', name: 'middle' },
      { value: 'small', name: 'small' },
    ],
  },
  {
    form_type: 'Switch',
    title_or_label: QuickTool.tooltip({ title: '可分页', help: '可分页', required: true }),
    dataIndex_or_field: 'is_pagination',
    key: 'is_pagination',
    placeholder: '',
    width: 120,
    col: 12,
    initialValue: '',
    list: [],
  },

  {
    form_type: 'Switch',
    title_or_label: QuickTool.tooltip({ title: '可新增', help: '可新增', required: true }),
    dataIndex_or_field: 'is_add',
    key: 'is_add',
    placeholder: '',
    width: 80,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Switch',
    title_or_label: QuickTool.tooltip({ title: '可删除', help: '可删除', required: true }),
    dataIndex_or_field: 'is_remove',
    key: 'is_remove',
    placeholder: '',
    width: 80,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({ title: '数据主键', help: '数据主键', required: true }),
    dataIndex_or_field: 'rowKey',
    key: 'rowKey',
    placeholder: '',
    width: 180,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({
      title: '嵌套子表格code',
      help: '嵌套子表格code',
      required: true,
    }),
    dataIndex_or_field: 'expanded_code',
    key: 'expanded_',
    placeholder: '',
    width: 180,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({
      title: '新增表格代码',
      help: '新增表格代码',
      required: true,
    }),
    dataIndex_or_field: 'sys_form_set_code',
    key: 'sys_form_set_code',
    placeholder: '',
    width: 180,
    col: 12,
    initialValue: '',
    list: [],
  },
  {
    form_type: 'Input',
    title_or_label: QuickTool.tooltip({
      title: '删除API地址',
      help: '删除API地址',
      required: true,
    }),
    dataIndex_or_field: 'remove_url',
    key: 'remove_url',
    placeholder: '',
    width: 180,
    col: 24,
    initialValue: '',
    list: [],
  },
];

const initialSearchList: {
  col?: number;
  form_type?: string;
  title_or_label?: JSX.Element | string;
  dataIndex_or_field?: string;
  key?: string;
  placeholder?: string;
  width?: number;
  initialValue?: string;
  list?: {
    value?: string;
    name?: string;
  }[];
  custom_sort?: boolean;
}[] = [
  // { form_type: '__operate', custom_sort: true },
  { ...fieldList[1], col: 6 },
  { ...fieldList[0], col: 6 },
  { ...fieldList[2], col: 6 },
  { ...fieldList[3], col: 6 },
];

const dataSource = [
  {
    sys_form_set_code: 'f97c6421decb',
    label: '内容发布',
    data_url: '/api/common/vw_baade_notice/page',
    placeholder: '请输入标签名称',
    size: 'middle',
    required: 1,
    tooltip: '发布内容的东西',
    rowKey: 'id',
    is_pagination: 0,
    is_add: 1,
    is_delete: 1,
    expanded_code: '',
    delete_url: '',
    editable: false,
    sort: 1,
  },
  {
    sys_form_set_code: 'f97c6421decb',
    label: '内容发布',
    data_url: '/api/common/vw_baade_notice/page',
    placeholder: '请输入标签名称',
    size: 'middle',
    required: 1,
    tooltip: '发布内容的东西',
    rowKey: 'id',
    is_pagination: 0,
    is_add: 1,
    is_delete: 1,
    expanded_code: '',
    delete_url: '',
    editable: false,
    sort: 2,
    field: 'content',
    form_type: 'Input',
  },
];

export {
  fieldList,
  initialSearchList,
  dataSource,
  apiPath,
  tableOperateExpandList,
  pagination,
  extraData,
  popupForm,
};
